package com.cw.demo.proxy.cglib;

import java.lang.reflect.Method;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

/**
 * TODO
 *
 * @author chenw
 * @date 2021/4/11
 */
public class MyMethodInterceptor implements MethodInterceptor {
    @Override
    public Object intercept(Object object, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        System.out.println("这里是对目标类增强");
        //注意这里的调用，不是反射哦
        Object obj = methodProxy.invokeSuper(object,args);
        return obj;
    }
}
